package pl.edu.pw.ee.buildcity.scheduler;

import org.apache.log4j.Logger;
import pl.edu.pw.ee.buildcity.commons.exceptions.BuildCityRuntimeException;

/**
 * @author mgrzechocinski
 * @since 2009-10-18
 */
public class SchedulerRuntimeException extends BuildCityRuntimeException {

	private static final long serialVersionUID = 1L;

	private static final Logger log = Logger.getLogger(SchedulerRuntimeException.class);

	public static SchedulerRuntimeException withMessage(String msg) {
		return new SchedulerRuntimeException(msg, null);
	}

	public static SchedulerRuntimeException withException(Exception e) {
		return new SchedulerRuntimeException(e.getMessage(), e);
	}

	public static SchedulerRuntimeException withMessageAndException(String msg, Exception e) {
		return new SchedulerRuntimeException(msg, null);
	}

	private SchedulerRuntimeException(String msg, Exception e) {
		super(msg, e);
		log.error("Scheduler exception occurred: " + msg, e);
	}
}
